package top.humbleyuan.designmode.singleton;

/**
 * @Author HumbleYuan
 * @Date 2019/10/9 17:32
 * @Des 静态私有内部类，线程安全
 */
public class InnerClassSingleton {
    private InnerClassSingleton() {}

    //内部类在被调用的时候才实例化其静态成员变量
    private static class getInstance {
        private static InnerClassSingleton singleton = new InnerClassSingleton();
    }

    public static InnerClassSingleton getSingleton() {
        return getInstance.singleton;
    }
}
